/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.inartea.common.bean;

import java.util.Locale;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Component;

/**
 * Inartea
 * 
 * @date Apr 8, 2012
 * 
 * @author piu
 */
@Component
public class MessageResource {
	private final MessageSource messageSource;

	@Autowired
	public MessageResource(MessageSource messageSource) {
		this.messageSource = messageSource;
	}

	public String getText(String text) {
		return messageSource.getMessage(text, null, Locale.getDefault());
	}
	
	public String getText(String text, Object ...params) {
		return messageSource.getMessage(text, params, Locale.getDefault());
	}
}
